package org.example.secondkill.rabbitmq;

import org.example.secondkill.redis.RedisService;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MQSender {
    @Autowired
    AmqpTemplate amqpTemplate;

    public void sendKillMessage(OrderMessage mm) { // direct
        String msg = RedisService.beanToString(mm);
        amqpTemplate.convertAndSend(MQConfig.KILLSECOND_QUEUE, msg);
    }
}
